/**
 * Copyright © 2016-2022 The Thingsboard Authors
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.thingsboard.server.dao.iotconfig;

import org.thingsboard.server.common.data.IotConfig;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.dao.Dao;
import org.thingsboard.server.dao.TenantEntityDao;

import java.util.Optional;
import java.util.UUID;

public interface IotConfigDao extends Dao<IotConfig>, TenantEntityDao {

    /**
     * Save or update iotConfig object
     *
     * @param iotConfig the iotConfig object
     * @return saved iotConfig object
     */
    IotConfig save(TenantId tenantId, IotConfig iotConfig);

    /**
     * Find iotConfigs by tenant id and page link.
     *
     * @param tenantId the tenant id
     * @param pageLink the page link
     * @return the list of iotConfig objects
     */
    PageData<IotConfig> findIotConfigsByTenantId(UUID tenantId, PageLink pageLink);

    /**
     * Find iotConfigs by tenantId and iotConfig title.
     *
     * @param tenantId the tenantId
     * @param title    the iotConfig title
     * @return the optional iotConfig object
     */
    Optional<IotConfig> findIotConfigsByTenantIdAndTitle(UUID tenantId, String title);

}
